package com.stefan.config;

import com.github.benmanes.caffeine.cache.Caffeine;
import com.stefan.entity.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.github.benmanes.caffeine.cache.Cache;

@Configuration
public class CaffeineCacheConfig {
    // Caffeine cache configuration can be added here if needed
    // For example, you can define beans for CaffeineCacheManager or CaffeineCache
    // and configure cache properties like maximum size, expiration, etc.
    // Example:

    @Bean(name = "userCache")
    public Cache<String, User> userCache() {
        return Caffeine.newBuilder()
                .initialCapacity(10) // Initial capacity of the cache
                .maximumSize(100) // Maximum size of the cache
                .expireAfterWrite(10, java.util.concurrent.TimeUnit.MINUTES) // Expiration time after write
                .build();
    }
}
